<?php
//Project structure paths
defined("ROOT_PATH") or define("ROOT_PATH", realpath(dirname(__FILE__) . '/..'));
    
    //Environment dependant (e.g. Database connection credentials, Proxy, etc)
    //Locate this file in a folder out of the project, so that you can copy the entire project folder
    //from development environment to production environment keeping the different values for each environment
    defined("ENVIRONMENT_FILE") or define("ENVIRONMENT_FILE", ROOT_PATH.'/../srv/environment.php');
    require_once ENVIRONMENT_FILE;


        defined("RESOURCES_PATH") or define("RESOURCES_PATH", ROOT_PATH . '/resources');
        
                defined("LIBRARY_PATH") or define("LIBRARY_PATH", RESOURCES_PATH . '/library');
                                
                        defined("LOG_MANAGER_PATH") or define("LOG_MANAGER_PATH", LIBRARY_PATH . '/log');

                defined("MODELS_PATH") or define("MODELS_PATH", realpath(dirname(__FILE__) . '/models'));
                defined("VIEWS_PATH") or define("VIEWS_PATH", realpath(dirname(__FILE__) . '/views'));
                defined("CONTROLLERS_PATH") or define("CONTROLLERS_PATH", realpath(dirname(__FILE__) . '/controllers'));
	
//Shortcuts to common classes
defined("LOG_CLASS") or define("LOG_CLASS", LOG_MANAGER_PATH . '/log.php');

//Autoload Classes
function __Autoload($classname){
    require_once LIBRARY_PATH.'/'.$classname.'/'.$classname.'.class.php';
}


//Function to show configuration
function showConfig(){
    echo "<table border=\"1\">";
    echo "<tr><td colspan=\"2\">Paths</td></tr>";
    echo "<tr><td>ENVIRONMENT_FILE</td><td>".ENVIRONMENT_FILE."</td></tr>";
    echo "<tr><td>ROOT_PATH</td><td>".ROOT_PATH."</td></tr>";
    echo "<tr><td>RESOURCES_PATH</td><td>".RESOURCES_PATH."</td></tr>";
    echo "<tr><td>LIBRARY_PATH</td><td>".LIBRARY_PATH."</td></tr>";
    echo "<tr><td>DB_PATH</td><td>".DB_PATH."</td></tr>";
    echo "<tr><td>LOG_MANAGER_PATH</td><td>".LOG_MANAGER_PATH."</td></tr>";
    echo "<tr><td>MODELS_PATH</td><td>".MODELS_PATH."</td></tr>";
    echo "<tr><td>VIEWS_PATH</td><td>".VIEWS_PATH."</td></tr>";
    echo "<tr><td>CONTROLLERS_PATH</td><td>".CONTROLLERS_PATH."</td></tr>";
    echo "<tr><td>HTTP_PROXY</td><td>".HTTP_PROXY."</td></tr>";
    echo "<tr><td>COOKIES_FILE</td><td>".COOKIES_FILE."</td></tr>";
    echo "<tr><td>LOG_FILE</td><td>".LOG_FILE."</td></tr>";
    echo "<tr><td>LOG_ENABLED</td><td>".LOG_ENABLED."</td></tr>";
    echo "</table>";
}
?>